package com.ktg.web.wms;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ktg.ktgcommon.domain.mainData.MdVendor;
import com.ktg.ktgcommon.domain.wms.WmItemRecpt;
import com.ktg.ktgcommon.result.R;
import com.ktg.service.WmItemService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("api/wmsItem")
public class WmItemController {
    @Resource
    WmItemService wmItemService;
    @RequestMapping("/pageList")
    public R getPageList(@RequestParam(defaultValue = "1") Integer pageNo,
                         @RequestParam(defaultValue = "10") Integer pageSize,@RequestBody WmItemRecpt wmItemRecpt){
        Page<WmItemRecpt> wmItemRecptPage = new Page<>(pageNo, pageSize);
        Page<WmItemRecpt> wmItemRecptPage1 = wmItemService.getByWasStoPage(wmItemRecptPage,wmItemRecpt);
        if (wmItemRecptPage1 != null) {
            return R.OK(wmItemRecptPage1);
        }
        return R.FAIL();
    }
    @RequestMapping("/MdVdeorList")
    public R getMdVdeorList (@RequestParam(defaultValue = "1") Integer pageNo,
                             @RequestParam(defaultValue = "10") Integer pageSize,@RequestBody MdVendor mdVendor){
        Page<MdVendor> wmItemRecptPage = new Page<>(pageNo, pageSize);
        Page<MdVendor> wmItemRecptPage1 = wmItemService.getByVendorPage(wmItemRecptPage,mdVendor);
        if (wmItemRecptPage1 != null) {
            return R.OK(wmItemRecptPage1);
        }
        return R.FAIL();
    }
}
